"use strict";

/**
 * @auther wtfssd
 * Created by wtfssd on 2017/11/13
 */
const I18n = require('react-native-i18n').default;
const {getLanguages} = require('react-native-i18n');
import zh from '../assets/language/zh'
import en from '../assets/language/en'

const moment = require("moment");

import 'moment/locale/zh-cn';

I18n.fallbacks = true;
I18n.translations = {
    zh,
    en
};

getLanguages().then((data) => {
    if (data[0].indexOf('en') === -1) {
        moment.locale('zh-cn');
    } else {
        moment.locale('en');
    }
});

/**
 * 多语言
 * @param {string} word
 * @return {String}
 */
function T(word: string): string {
    return I18n.t(word);
}


export default T;
